{template header}
<style type="text/css">
    td.nickname {text-overflow: ellipsis;width: 180px;}
    td.nickname p { display: inline-block; vertical-align: middle; width: 100px; margin-left: 5px; }
    td.nickname img { border-radius: 5px; border: 2px solid #fff; outline: 1px solid #ccc; }
    
    td:nth-child(2) {max-width: 100px; }

</style>
<script type="text/javascript">
    $(document).ready(function(){
        $("button.removeHot").click(function(e){
            var postId = $(this).prop("id");
            var postv = $(this).prop("name");
            console.info(postv);
            var func = "ignoreHotPost";
            if(postv=='2.5')
                func = "ignoreHotPost2";

            $.ajax({url:"index.php?c=admin&a="+func+"&postId=" + postId,
                  async:false,
                  dataType:"json",
                  error:function(){
                      alert('未知错误');
                      },
                  success: function(data, status)
                  {
                       if (dealBack(data, status)== 0)
                       {
                         $("#cancleIgnorePost_"+postId).remove();
                       }
                  }
              });
            return true;
        });
        $("button.cancelIgnore").click(function(e){
            var postId = $(this).prop("id");
            var postv = $(this).prop("name");
            var funcs = "cancleIgnoreHotPost";
            if(postv=='2.5')
                funcs = "cancleIgnoreHotPost2";


            $.ajax({url:"index.php?c=admin&a="+funcs+"&postId=" + postId,
                  async:false,
                  dataType:"json",
                  error:function(){
                      alert('未知错误');
                      },
                  success: function(data, status)
                  {
                        if(dealBack(data, status) == 0)
                        {
                            $("#ignorePost_"+postId).remove();
                        }
                  }
              });
            return true;
        });
        $("button.flushHotPost").click(function(){
            location.href = "index.php?c=admin&a=topHotPostList&fresh=1";
        });
     
    });
    function dealBack(data, status)
    {
        turnData = eval(data);
        if(turnData.cd == 0)
        {
            $(".tips > div").removeClass("alert-error");
            $(".tips > div").addClass("alert-success");
        }
        else
        {
            $(".tips > div").removeClass("alert-success");
            $(".tips > div").addClass("alert-error");
        }
        $(".tips strong").html(turnData.msg);
        $(".tips").removeClass("hidden");

        return turnData.cd;
    }
</script>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
        <a href="?c=admin&a=topHotPostList&v=2.4" target="_self"><i class="icon-eye-open"></i> 2.4版本</a> &nbsp;&nbsp;
        <a href="?c=admin&a=topHotPostList&v=2.5" target="_self"><i class="icon-eye-open"></i> 2.5版本</a> &nbsp;&nbsp;
        <a href="?c=admin&a=topHotPostList&v={$postv}&fresh=1" target="_self"><i class="icon-plane"></i> 刷新</a>
        </div>
    </div>
    <div class="row-fluid">
        <div class=" tips hidden">
            <div class="alert">
                 <button type="button" class="close" data-dismiss="alert">×</button>
                <h4>
                    提示!
                </h4> 
            </div>
        </div>
  
        <div class="tabbable mt-10" id="tabs-82287">
           
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#panel-158419" data-toggle="tab">热门帖子</a>
                </li>
                <li>
                    <a href="#panel-665242" data-toggle="tab">屏蔽帖子</a>
                </li>
                <li>
                    <a href="?index.php&c=admin&a=testTopPostList" target="_blank">测试热门帖子1</a>
                </li>
                <li>
                    <a href="?index.php&c=admin&a=testTopPostList&t=1" target="_blank">测试热门帖子2</a>
                </li>
                <li>
                    <a href="?index.php&c=admin&a=testTopPostList&t=2" target="_blank">测试热门帖子3</a>
                </li>
                <li>
                    <a href="?index.php&c=admin&a=testTopPostList&t=3" target="_blank">测试热门帖子4</a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="panel-158419">
                    <div class="bs-docs-example" style="clear:both;">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>发帖人</th>
                                    <th>标题</th>
                                    <th>版块</th>
                                    <th>标签</th>
                                    <th width="145">添加时间|最后更新</th>
                                    <th>总评论</th>
                                    <th>喜欢</th>
                                    <th>热度值</th>
                                    <th width="150">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {loop $postList $k $v}
                                <tr id = "cancleIgnorePost_{$v['news_id']}">
                                    <td class="nickname">
                                        <img width="50" src="{$v['header']}">
                                        <p>{$v['nickname']}</p>
                                    </td>
                                    <td>{$v['title']}</td>
                                    <td>{loop $v['board'] $kk $board}<div id="{$board['boardId']">{$board['boardName']}</div>{/loop}</td>
                                    <td>{loop $v['tag'] $kk $tag}<div id="{$tag['tagId']}">{$tag['tagName']}</div>{/loop}</td>
                                    <td>
                                        {eval echo date('Y-m-d H:i:s', $v['add_time'])}<br>
                                        {eval echo date('Y-m-d H:i:s', $v['lastupdate'])}
                                    </td>
                                    <td>{$v['total_comment']}</td>
                                    <td>{$v['loves']}</td>
                                    <td>{$v['hotNum']}</td>
                                    <td>
                                        <button class="btn btn-danger removeHot" name="{$postv}" id="{$v['news_id']}">移除</button>
                                    </td>
                                </tr>
                                {/loop}
                            </tbody>
                        </table>
                    </div>

                    {if ($postv > 2.4)}
                    <div class="pagination">
                        <ul>
                            {$pageStr}
                        </ul>
                    </div>
                    {/if}
                </div>
                <div class="tab-pane" id="panel-665242">
                    <div class="bs-docs-example" style="clear:both;">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>发帖人</th>
                                    <th>标题</th>
                                    <th>版块</th>
                                    <th>标签</th>
                                    <th width="145">添加时间|最后更新</th>
                                    <th>总评论</th>
                                    <th>喜欢</th>
                                    <th>热度值</th>
                                    <th width="150">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {loop $hotPostIgnore $k $v}
                                <tr id="ignorePost_{$v['news_id']}">
                                    <td class="nickname">
                                        <img width="50" src="{$v['header']}">{$v['nickname']}
                                    </td>
                                    <td>{$v['title']}</td>
                                    <td>{loop $v['board'] $kk $board}<div id="{$board['boardId']">{$board['boardName']}</div>{/loop}</td>
                                    <td>{loop $v['tag'] $kk $tag}<div id="{$tag['tagId']}">{$tag['tagName']}</div>{/loop}</td>
                                    <td>
                                        {eval echo date('Y-m-d H:i:s', $v['add_time'])}<br>
                                        {eval echo date('Y-m-d H:i:s', $v['lastupdate'])}
                                    </td>
                                    <td>{$v['total_comment']}</td>
                                    <td>{$v['loves']}</td>
                                    <td>{$v['hotNum']}</td>
                                    <td>
                                    <button class="btn btn-danger cancelIgnore" name="{$postv}" id="{$v['news_id']}">取消屏蔽</button>
                                    </td>
                                </tr>
                                {/loop}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

            
        </div>

</div>

<!-- </form> -->
{template footer}
